package com.fengxing.ams.web.facade.mouble.company;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

public interface ICompanyDAO extends PagingAndSortingRepository<CompanyVO, Integer>, JpaSpecificationExecutor<CompanyVO>  {
	@Query(value="select * from zyt_enployment where student_id=:student_id", nativeQuery=true)
	CompanyVO findByStudentId(@Param("student_id")String studentId);

	@Query(value="select * from zyt_enployment where student_college=:student_college and status in (0, 5)", nativeQuery=true)
	List<CompanyVO> queryOrdersForCheck(@Param("student_college")Integer collegeId);

	@Query(value="select * from zyt_enployment where status in (3, 8)", nativeQuery=true)
	List<CompanyVO> queryOrdersForCheck();

	@Modifying
	@Query(value="update zyt_enployment set status=:nextStatus, remark=:remark where id=:id", nativeQuery=true)
	void updateStatus(@Param("remark")String remark, @Param("id")Integer id, @Param("nextStatus")Integer nextStatus);

	@Modifying
	@Query(value="delete from  zyt_enployment where student_id in (:ids)", nativeQuery=true)
	void deleteAllByIds(@Param("ids")List<String> ids);

	@Query(value="select * from  zyt_enployment where student_id = (:student_id)", nativeQuery=true)
	CompanyVO findByStduentId(@Param("student_id")String studentId);
}

